package com.ttg.web.dao.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttg.common.config.DynamicTableNameHelper;
import com.ttg.common.dto.TagProducer;
import com.ttg.common.entities.BasePage;
import com.ttg.common.utils.DateTimeUtil;
import com.ttg.model.dto.MctInfoListGetDto;
import com.ttg.model.dto.open.QueryVipGradeByMctNoDto;
import com.ttg.model.mapper.BankPublicPrimitiveAumMapper;
import com.ttg.model.mapper.BankPublicPrimitiveMapper;
import com.ttg.model.pojo.BankPrivatePrimitive;
import com.ttg.model.pojo.BankPublicPrimitive;
import com.ttg.model.pojo.BankPublicPrimitiveAum;
import com.ttg.model.pojo.VipRatingConfig;
import com.ttg.model.vo.MctInfoListGetVo;
import com.ttg.model.vo.VipInfoGetListVo;
import com.ttg.model.vo.open.QueryVipGradeByMctVo;
import com.ttg.model.vo.open.QueryVipPublicTagInfoVo;
import com.ttg.web.dao.BankPublicPrimitiveAumDao;
import com.ttg.web.dao.BankPublicPrimitiveDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @author zhangHongYuan
 * @description
 * @date 2024/4/11 16:43
 */
@Service
public class BankPublicPrimitiveAumDaoImpl extends ServiceImpl<BankPublicPrimitiveAumMapper, BankPublicPrimitiveAum> implements BankPublicPrimitiveAumDao {

    @Override
    public void truncate() {
        baseMapper.truncate();
    }
    @Override
    @Transactional(
            rollbackFor = {Exception.class}
    )
    public boolean saveBatchTypeSplit(Map<String, List<BankPublicPrimitiveAum>> batMap) {
        for (Map.Entry<String, List<BankPublicPrimitiveAum>> entry : batMap.entrySet()) {
            Map<String, String> tableSuffix = DynamicTableNameHelper.getTableSuffix();
            tableSuffix.put("tbl_bank_public_primitive_aum", entry.getKey());
            DynamicTableNameHelper.setTableSuffix(tableSuffix);
            saveBatch(entry.getValue());
        }
        return true;
    }
}
